package com.openlab.service.notice.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.openlab.service.notice.dto.NoticeDetailInfo;
import com.openlab.service.notice.dto.NoticeInfoDto;
import com.openlab.service.notice.dto.NoticeParam;
import com.openlab.service.notice.entity.NoticeToUser;
import com.openlab.service.notice.mapper.NoticeToUserMapper;
import com.openlab.service.notice.service.NoticeToUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @Author
 *
 */
@Service
public class NoticeToUserServiceImpl extends ServiceImpl<NoticeToUserMapper, NoticeToUser> implements NoticeToUserService {

    @Override
    public IPage<NoticeInfoDto> selectPage(NoticeParam noticeParam) {
        Page page = this.page(
                new Page<>(noticeParam.getPage_num(), noticeParam.getPage_size()));
        IPage<NoticeInfoDto> pageVo = baseMapper.selectPageVo(page,noticeParam.getPublished(),noticeParam.getCommunity_id().longValue());
        return pageVo;
    }

    @Override
    public Map<String, Object> detail(Long id, Long community_id) {
        Map<String, Object> detail = baseMapper.getDetail(id, community_id);
        return detail;
    }
}
